<?

	class Cms_Html
	{
		public static function flash()
		{
			$result = null;

			foreach ( Phpr::$session->flash as $type=>$message )
			{
				if ($type == 'system')
					continue;

				$result .= '<p class="flash '.$type.'">'.h($message).'</p>';
			}

			Phpr::$session->flash->now();

			return $result;
		}
		
		public static function content_block($code, $name)
		{
			global $_cms_current_page_object;
			if (!$_cms_current_page_object)
				return;

			return $_cms_current_page_object->get_content_block_content($code);
		}
		
		public static function site_url($url)
		{
			return root_url($url, true);
		}
		
		public static function include_resources($src_mode = false)
		{
			if ($src_mode)
			{
				$result = '<script type="text/javascript" src="'.root_url('/modules/cms/resources/javascript/mootools_src.js').'"></script>'."\n";
				$result .= '<script type="text/javascript" src="'.root_url('/modules/cms/resources/javascript/mootools_more_src.js').'"></script>'."\n";
				$result .= '<script type="text/javascript" src="'.root_url('/modules/cms/resources/javascript/frontend_src.js?dir='.Phpr::$request->getSubdirectory()).'&amp;ver='.module_build('cms').'"></script>'."\n";
				$result .= '<link rel="stylesheet" type="text/css" href="'.root_url('/modules/cms/resources/css/frontend_css.css').'" />'."\n";
			} else
			{
				$result = '<script type="text/javascript" src="'.root_url('/modules/cms/resources/javascript/frontend.js?dir='.Phpr::$request->getSubdirectory()).'&amp;ver='.module_build('cms').'"></script>'."\n";
				$result .= '<link rel="stylesheet" type="text/css" href="'.root_url('/modules/cms/resources/css/frontend_css.css').'" />'."\n";
			}
			
			return $result;
		}
	}

?>